package com.zm.test2;
/**
 *<4>写一个类MainTest,定义一个主方法，在主方法中分别生成若干个Book,JavaseBook和JavaeeBook,并调用他们方法。
 */
public class MainTest {
    public static void main(String[] args) {
        Book book=new Book();
        JavaseBook javaseBook=new JavaseBook(123,"abc","李白",1234,"啦啦啦","1949/10/1");
        JavaeeBook javaeeBook=new JavaeeBook(1234,"abcd","杨广",12345,"啦啦啦啦","1949/10/1");
        book.displayInfo();
        book.displayInfo(5);
        javaeeBook.displayInfo();
        javaseBook.displayInfo();
    }

}
/*<1>编写图书(Book)类，该类有私有属性包括:id,图书名称，作者，单价，出版社，出版日期(String)类型，类别。
   要求为私有属性提供public访问方法。
   并提供两个重载的构造方法，一个有参，分别给所有属性赋值。
   另一个无参，默认给图书名称赋值为Java程序设计，作者为xxx;该类有两个重载的displayInfo()方法。
   其中一个无参displayInfo()方法，在屏幕上输出:XXX reading book!(XXX为图书名称)
   另一个需要一个int参数n,在屏幕上输出n次 XXX reading book!*/
class Book{
    private  int bookId;
    private String bookName;
    private String bookAuthor;
    private int bookPrice;
    private String bookPress;
    private String bookDate;

    public Book(int bookId, String bookName, String bookAuthor, int bookPrice, String bookPress, String bookDate) {
        this.bookId = bookId;
        this.bookName = bookName;
        this.bookAuthor = bookAuthor;
        this.bookPrice = bookPrice;
        this.bookPress = bookPress;
        this.bookDate = bookDate;
    }

    public Book() {
        this.bookName="Java程序设计";
        this.bookAuthor="XXX";
    }
    public void displayInfo(){
        System.out.println(this.bookName+"Reading book!!");
    }
    public void displayInfo(int n){
        for (int i=0;i<n;i++){
            System.out.println(this.bookName+"Reading book!!");
        }
    }
    public int getBookId() {
        return bookId;
    }

    public void setBookId(int bookId) {
        this.bookId = bookId;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public String getBookAuthor() {
        return bookAuthor;
    }

    public void setBookAuthor(String bookAuthor) {
        this.bookAuthor = bookAuthor;
    }

    public int getBookPrice() {
        return bookPrice;
    }

    public void setBookPrice(int bookProice) {
        this.bookPrice = bookProice;
    }

    public String getBookPress() {
        return bookPress;
    }

    public void setBookPress(String bookPress) {
        this.bookPress = bookPress;
    }

    public String getBookDate() {
        return bookDate;
    }

    public void setBookDate(String bookDate) {
        this.bookDate = bookDate;
    }
}
/**
 *   <2>写一个类JavaseBook,继承自Book类，并提供一个构造方法，该构造方法需要给父类中的所有属性赋值;
 *     该类还要求覆盖Book类中的无参displayInfo()方法，要求输出：XXX reading JavaSeBook!
 */
class JavaseBook extends Book{

    public JavaseBook(int bookId, String bookName, String bookAuthor, int bookProice, String bookPress, String bookDate) {
        super(bookId, bookName, bookAuthor, bookProice, bookPress, bookDate);
    }

    @Override
    public void displayInfo() {
        System.out.println(super.getBookName()+"reading JavaSebook!");
    }
}
/*
*   <3>写一个类JavaeeBook,继承自Book类，并提供一个有参构造方法
     该类还要求覆盖Book类中的有参displayInfo(int n)方法，要求输出：XXX reading JavaeeBook!
* */
class JavaeeBook extends Book{
    public JavaeeBook(int bookId, String bookName, String bookAuthor, int bookProice, String bookPress, String bookDate) {
        super(bookId, bookName, bookAuthor, bookProice, bookPress, bookDate);
    }

    @Override
    public void displayInfo(int n) {
        System.out.println(super.getBookName()+"reading JavaeeBook!");
    }
}